#ifndef _OI_SLICEBALANCE_IMAGEVIEWER_H_
#define _OI_SLICEBALANCE_IMAGEVIEWER_H_

#include "Appl/OiAppl.hpp"

namespace Oi
{
    namespace Appl
    {
        class OI_VIEW_API Studio : public QGraphicsView
        {
            Q_OBJECT
        public:
            Studio(QWidget* parent = NULL);

        public:
            ~Studio();

        public:
            Raster* raster() const;

signals:
            void enterFullScreen();
            void leaveFullScreen();

            public slots:
            void zoomOut(double factor);

            public slots:
            void zoomFit();
            void zoomOrg();

            public slots:
            void showParameterPanel();
            void hideParameterPanel();

            void show3DLayer();
            void show2DLayer();

            void hideMenu(bool);

            public slots:
            void display(const Core::PointMapPtr& pointMap, int start = -1, int lines = -1);
            void display(const Core::RangeMapPtr& rangeMap, int start = -1, int lines = -1);
            void display(const QImage& image, int start = -1, int lines = -1);

            public slots:
            void display(const QString& name, const Core::PointMapPtr& pointMap, int start = -1, int lines = -1);
            void display(const QString& name, const Core::RangeMapPtr& rangeMap, int start = -1, int lines = -1);
            void display(const QString& name, const QImage& image, int start = -1, int lines = -1);

            public slots:
            void synchronize();

            public slots:
            void invalidate();

        protected:
            bool event(QEvent* event);

        protected:
            void keyPressEvent(QKeyEvent *event);
            void keyReleaseEvent(QKeyEvent *event);
            void drawForeground(QPainter *painter, const QRectF &rect);
            void drawBackground(QPainter *painter, const QRectF &rect);
            void enterEvent(QEvent*);
            void leaveEvent(QEvent*);
            void mousePressEvent(QMouseEvent *event);
            void mouseReleaseEvent(QMouseEvent *event);
            void mouseMoveEvent(QMouseEvent *event);
            void mouseDoubleClickEvent(QMouseEvent *event);
            void contextMenuEvent(QContextMenuEvent *event);
            bool focusNextPrevChild(bool next) override;
            void wheelEvent(QWheelEvent *event);
            void resizeEvent(QResizeEvent *event);
            void paintEvent(QPaintEvent *event);
            void showEvent(QShowEvent *event);
            void hideEvent(QHideEvent *event);

            private slots:
            void onActionTriggered();
            void onTargetTriggered(QAction*);
            void onTimeout();
            void onRubberBandChanged(QRect viewportRect, QPointF fromScenePoint, QPointF toScenePoint);

        private:
            OI_DISABLE_COPY(Studio);
            OI_DECLARE_IMPL(Studio);
        };

    }
}

#endif
